﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BLL;

namespace Client.View
{
    /// <summary>
    /// Interaction logic for SelectQuizView.xaml
    /// </summary>
    public partial class SelectQuizView : UserControl
    {
        public delegate void StartClickEvent(int quizId);
        public event StartClickEvent OnStartClicked;

        public SelectQuizView()
        {
            InitializeComponent();
        }

        private void lbQuizes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            btnstart.IsEnabled = true;
        }

        private void btnstart_Click(object sender, RoutedEventArgs e)
        {
            var quiz = (Quiz)lbQuizes.SelectedItem as Quiz;
            if (OnStartClicked != null && quiz != null)
            {
                OnStartClicked(quiz.ID);
            }
        }
    }
}
